package com.tuu.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;


public class CookieUtils {

    public static String getCookie(HttpServletRequest request, String name) {
        Cookie[] cookies = request.getCookies();

        if (cookies==null) {
            return null;
        }
        String cookie = null;
        for (Cookie c : cookies) {
            if (name.equals(c.getName())) {
                cookie = c.getValue();
                break;
            }
        }
        return cookie;
    }
}
